package service.impl;

import dao.StudentDao;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import pojo.Student;
import service.Studentservice;

import java.util.List;
@Service("studentservice")
public class StudentServiceimpl implements Studentservice{
    @Autowired
    private StudentDao studentDao;
    @Override
    public List<Student> findAll(Student student, int offset, int pageSize) {
        List<Student> students = studentDao.findAll(student, offset, pageSize);
        return students;
    }

    @Override
    public int addStudent(Student student) {
        return studentDao.addStudent(student);
    }

    @Override
    public Student findById(Integer id) {
        return studentDao.findById(id);
    }

    @Override
    public int UpdateStudent(Student student) {
        return studentDao.UpdateStudent(student);
    }

    @Override
    public int DeleteStudentById(Integer id) {
        return studentDao.DeleteStudentById(id);
    }

    @Override
    public int count(Student student) {
        int count = studentDao.count(student);
        if (count>0){
            return count;
        }
        return 0;
    }



}
